import request from '../utils/request';



// 新增地址
export const addAddressService = (address) => {
    return request.post('/address/addAddress', address);
}

// 删除地址
export const deleteAddressService = (addressId) => {
    const params = new URLSearchParams();
    params.append('addressId', addressId);
    return request.post('/address/deleteAddress', params);
}

// 修改地址
export const updateAddressService = (address) => {
    return request.post('/address/updateAddress', address);
}

// 更改订单的收货地址
export const updateOrderAddressService = (orderDetailId, data) => {
    console.log(data);
    return request.put(`/order/updateAddressOfOrders/${orderDetailId}`, data, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 获取地址列表
export const getAddressListService = () => {
    return request.get('/address/getAddressList');
}




